package app.view.component.tooltips 
{
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;

	public final class SpriteUtils
	{
		
		public function SpriteUtils() 
		{
			throw new Error("SpriteUtils must not be instantiated");
		}
		/**
		 * Attach a Sprite instance into a DisplayObjectContainer instance
		 * @param	parent The parent of Sprite that will be attached
		 * @return
		 */
		public static function attachSprite(parent:DisplayObjectContainer):Sprite
		{
			var s:Sprite = createTooltipTail();
			return parent.addChild(s) as Sprite;
		}
		
		private static function createTooltipTail():Sprite {
			var _tail:Sprite = new Sprite();
			var b:Number = 1;
			var _w:Number = 12;
			var _h:Number = 12;
			
			_tail.graphics.moveTo(0, 0);
			_tail.graphics.beginFill(0xA65417);
			_tail.graphics.lineTo(_w * 0.5, _h);
			_tail.graphics.lineTo(_w, 0);
			_tail.graphics.lineTo(0, 0);
			_tail.graphics.endFill();
			
			_tail.graphics.moveTo(b, 0);
			_tail.graphics.beginFill(0xEEDE87);
			_tail.graphics.lineTo(_w * 0.5, _h-2*b);
			_tail.graphics.lineTo(_w-b, 0);
			_tail.graphics.lineTo(b, 0);
			_tail.graphics.endFill();
			
			/*
			_tail.graphics.lineStyle(0.1, 0x442702);
			_tail.graphics.moveTo(0, 0);
			_tail.graphics.lineTo(_w * 0.5, _h);
			_tail.graphics.lineTo(_w, 0);
			*/
			return _tail;
		}
		
	}
}